package com.yuyou.activity.group.service.service;

import java.util.Date;
import java.util.List;

import com.yuyou.activity.group.service.entity.ActivityGroupbuyOrder;
import com.yuyou.activity.group.service.vo.resp.RespActivityGroupBuyOrderListVo;
import com.yuyou.activity.group.service.vo.resp.RespActivityGroupBuyOrderVo;
import com.yuyou.activity.group.service.vo.resp.RespActivityGroupSPDetailUser;
import com.yuyou.activity.util.bean.Pagination;
import com.yuyou.activity.util.bean.ResBoolSimpleInfo;

public interface IActivityGroupbuyOrderService {
    int deleteByPrimaryKey(Long activityGroupbuyOrderId);

    int insert(ActivityGroupbuyOrder record);

    ActivityGroupbuyOrder selectByPrimaryKey(Long activityGroupbuyOrderId);
    
    /**
     * 根据orderId查出
     * @param projectCode
     * @param orderId
     * @return
     */
    ActivityGroupbuyOrder selectByOrderId(String projectCode,String orderId);
 
    /**
     * 根据refundId查出
     * @param projectCode
     * @param refundId
     * @return
     */
    ActivityGroupbuyOrder selectByRefundId(String projectCode,String refundId);

    int updateByPrimaryKeySelective(ActivityGroupbuyOrder record);

    List<ActivityGroupbuyOrder> findNotUpdateUser();

    List<ActivityGroupbuyOrder> getNeedSyncOrder();

    void updateStatusByList(List<ActivityGroupbuyOrder> list, Integer tag);

    void udateStatus(Long id , Integer status);

    List<ActivityGroupbuyOrder> findByGroupId(Long groupId);
    
    /**
     * 找出当前活动下成功支付的订单
     * @param groupId
     * @return
     */
    List<ActivityGroupbuyOrder> findSuccByGroupId(Long groupId);
    
    /**
     * 根据openId找出用户支付成功订单
     * @param openId
     * @return
     */
    List<ActivityGroupbuyOrder> findSuccByOpenId(String openId);
    
    /**
     * 创建一笔活动订单
     * @param record
     * @return
     */
    ResBoolSimpleInfo<String> add(ActivityGroupbuyOrder record);


    /**
     * 获取团下参团的用户列表
     * @param projectCode
     * @param activityGroupId
     * @return
     */
    List<RespActivityGroupSPDetailUser> selectUserListByGroupBugId(String projectCode, Long activityGroupId);


    /**
     * 获取我的订单
     * @param projectCode
     * @param openId
     * @return
     */
    List<RespActivityGroupBuyOrderVo> myOrder(String projectCode, String openId);

    /**
     * 根据id更新同步状态
      * @param id
     */
    void updateSyncById(Long id , Integer isSync);

    List<ActivityGroupbuyOrder> getAllNeedCheckOrder(Date bigTime , Date smallTime);

    /**
     * 后台获取全部用户订单列表
     * @return
     */
    List<RespActivityGroupBuyOrderListVo> getAllUserOrder(Pagination<RespActivityGroupBuyOrderListVo> queryPgn);


    /**
     * 后台获取全部用户订单列表总数
     * @param queryPgn
     * @return
     */
    Integer getAllUserOrderCount(Pagination<RespActivityGroupBuyOrderListVo> queryPgn);


    /**
     * 获取当前用户在该团的订单
     * @param projectCode
     * @param openId
     * @param activityGroupbuyId
     * @return
     */
    List<ActivityGroupbuyOrder> getOrderByOpenIdInGroup(String projectCode,String openId , Long activityGroupbuyId);

    /**
     * 获取用户订单渠道
     * @param projectCode
     * @param activityGroupId
     * @param openId
     * @return
     */
    String getChannelInOrder(String projectCode, Long activityGroupId,String openId);
}